<?php
//include_once('../includes/utilidades.php');
require_once('../includes/seguridad.php');
require_once('../includes/html.php');
session_start();
$rolesConAcceso = array('club','admin');
if (!rolOK($_SESSION['roles'],$rolesConAcceso))
        exit;
//print_r($tablas);
/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

 //conectaDb();
 $actual = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
 
 if (!isset($_REQUEST['idtemporada'])) {
     $temporadaid=$_SESSION['temporada'][0]['id'];
 }
    else {
        $temporadaid=$_REQUEST['idtemporada'];
 }
 $temporada=select("select * from temporada","id=" . $temporadaid);
 
 $_SESSION['temporada']=$temporada;
 $_SESSION['afterAdd']['club'] = $actual;
 $_SESSION['afterDel']['club'] = $actual;
 $_SESSION['afterUpdate']['club'] = $actual;

 print "<h1>Temporada: " . $temporada[0]['nombre'] . "</h1>";
 print "<h2>Clubs</h2>";
 $club = select2("select * from club order by nombre,zona");

 //print_r($_SESSION);
 $t = new HTML_Tabla($club);
 $t->setDisplayColumnNames(array('nombre'=>'Nombre','zona'=>'Zona','localidad'=>'Localidad'));
 $t->setEnlaces('id',array('Acceder'=>'verclub.php',
                            'Modificar'=>'../comun/editObjetoForm.php?nombreObjeto=club',
                            'Borrar'=>'../comun/borrarObjeto.php?nombreObjeto=club'));
 $t->toHTML();
 $t->printHTML();

 
 toHTML('club',$club,'id');
 
 if (isUserInRol($_SESSION['username'],"admin")) {
                HTMLadd2($club,'club',$tablas);
            }
 
 
 //print "<hr>";
 //print $actual;
 //print "<br>";
// print $_SERVER['PHP_SELF'];
         
 //print_r($_ENV);
 
 //print_r($_SERVER);
?>

